package org.finir.fakturisanje.business.eao;

import java.util.List;

import org.finir.fakturisanje.business.core.HibernateGenerickiEAOImpl;
import org.finir.fakturisanje.persistence.Preduzece;
import org.finir.fakturisanje.persistence.Usluga;
import org.hibernate.Query;
import org.hibernate.Session;

public class UslugaEAOImpl extends HibernateGenerickiEAOImpl implements UslugaEAO {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1316210360369015637L;

	@SuppressWarnings("unchecked")
	public List<Usluga> vratiSveUsluge(Preduzece preduzece) {

		if (preduzece != null) {
			String hql = "from UslugaBean k where k.preduzece=?";
			Session session = getSessionFactory().getCurrentSession();
			Query createQuery = session.createQuery(hql);
			createQuery.setEntity(0, preduzece);
			return createQuery.list();
		}
		return null;
	}

}
